package com.atguigu.algorithm;

import java.util.*;

public class FindTheBrotherLetter {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while(scanner.hasNext()){
            int n=scanner.nextInt();
            String[] strings=new String[n];
            for(int i=0;i<n;i++){
                strings[i]=scanner.next();
            }
            String x=scanner.next();
            int k=scanner.nextInt();
            int[] rootArray=new int[128];
            for(int i=0;i<x.length();i++){
                char ch=x.charAt(i);
                rootArray[ch]++;
            }
            //此时x已经匹配完成
            List<String> help=new ArrayList<>();
            int m=0;
            for(int i=0;i<strings.length;i++){
                if(strings[i].equals(x)){
                    continue;
                }else{
                    boolean flag=true;
                    int[] tmpArray= Arrays.copyOf(rootArray,rootArray.length);
                    for(int j=0;j<strings[i].length();j++){
                        char ch=strings[i].charAt(j);
                        tmpArray[ch]--;
                    }
                    for(int a:tmpArray){
                        if(a!=0){
                            flag=false;
                        }
                    }
                    if(flag){
                        help.add(strings[i]);
                        m++;
                    }
                }
            }
            Collections.sort(help);
            System.out.println(m);
            if(k<help.size()){
                System.out.println(help.get(k-1));
            }
        }
    }
}
